package com.kyl.controller;


import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.kyl.base.PageResponse;
import com.kyl.base.ResponseResult;
import com.kyl.dto.PostDto;
import com.kyl.service.PostService;
import com.kyl.vo.PostVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author WanJl
 * @version 1.0
 * @title PostController
 * @description 职位管理
 * @create 2025/1/10
 */
@Slf4j
@Api(tags = "职位管理相关接口")
@RestController
public class PostController {
    @Resource
    private PostService postService;


    /**
     * 职位分页查询
     *
     * @param postDto  职位DTO对象
     * @param pageNum  当前页码值
     * @param pageSize 每页显示条数
     * @return
     */
    @ApiOperation(value = "职位分页查询", notes = "职位分页查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "postDto", value = "职位DTO对象", required = true, dataType = "PostDto"),
                @ApiImplicitParam(name = "pageNum", value = "当前页码值", required = true, defaultValue = "1", dataType = "int"),
            @ApiImplicitParam(name = "pageSize", value = "每页显示条数", required = true, defaultValue = "10", dataType = "int")
    })
    @ApiOperationSupport(includeParameters = {"postDto.dataState", "postDto.postName", "postDto.deptNo"})
    @PostMapping("/post/page/{pageNum}/{pageSize}")
    public ResponseResult<PageResponse<PostVo>> findPostPage(
                                        @RequestBody PostDto postDto,
                                        @PathVariable int pageNum,
                                        @PathVariable int pageSize) {
        PageResponse<PostVo> pageResponse = postService.findPostPage(postDto, pageNum, pageSize);
        return ResponseResult.success(pageResponse);
    }


}
